home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Installer SDK Cornucopia 1.0.2 / Script Examples / ResList [inr#] Example / myResList.r < prev    next >
Encoding:
Text File  |  1996-09-23  |  8.7 KB  |  267 lines  |  [TEXT/MPS ]

  1. //
  2. //    myResList.r
  3. //
  4. //        This installer script source demonstrates use of Resource List atoms.
  5. //        The Resource List Atom allows the scriptwriter to install thousands of
  6. //        individual resources without the overhead of thousands of Resource
  7. //        Atoms in the script file.
  8. //        
  9. //        This example defines a Resource List Atom ('inr#') that contains 'vers'
  10. //        (3), 'vers' (4), and 'vers' (5) resources.  (Note: These 'vers'
  11. //        resources are never used for anything and are basically harmless.)  Three
  12. //      separate packages are defined that install each one of these resouces.
  13. //        The 'vers' (3) resource requires a copy of SimpleText to be present in
  14. //        the root directory of the target volume.  Otherwise, an installation error
  15. //        occurs.  The 'vers' (4) and (5) resouces will create a bogus copy of
  16. //        SimpleText if one is not present upon installation.
  17. //
  18. //        NOTE: This example uses pre-4.0 method for creating Custom Install options.
  19. //        It is not intended as an example of how to use 4.0 User Interface features.
  20. //        (See the "Custom UI Example" for an example of the 4.0 Interface features.)
  21. //
  22. //        Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
  23. //
  24.  
  25. #include "InstallerTypes.r"
  26.  
  27. // • packages
  28.  
  29. resource 'inpk' (100) {
  30.     format0 {
  31.         showsOnCustom,
  32.         removable,
  33.         dontForceRestart,
  34.         0,
  35.         0,
  36.         "ResList - add 'vers' ( 3 ) to SimpleText ( tgt req'd ) on root of tgt volume.",
  37.         {    
  38.         // even though this resource is defined within an 'inr#' you should specify 'inra'
  39.         'inra', 9000;                            // this ID is the same as the first field
  40.                                                 // for the desired item record in the 'inr#'
  41.         },
  42.     }
  43. };
  44.  
  45. resource 'inpk' (200) {
  46.     format0 {
  47.         showsOnCustom,
  48.         removable,
  49.         dontForceRestart,
  50.         0,
  51.         0,
  52.         "ResList - add 'vers' ( 4 ) to SimpleText ( no tgt req'd ) on root of tgt vol.",
  53.         {    
  54.         // even though this resource is defined within an 'inr#' you should specify 'inra'
  55.         'inra', 9001;                            // this ID is the same as the first field
  56.                                                 // for the desired item record in the 'inr#'
  57.         },
  58.     }
  59. };
  60.  
  61. resource 'inpk' (300) {
  62.     format0 {
  63.         showsOnCustom,
  64.         removable,
  65.         dontForceRestart,
  66.         0,
  67.         0,
  68.         "ResList - add 'vers' ( 5 ) to SimpleText ( no tgt req'd ) on root of tgt vol.",
  69.         {    
  70.         // even though this resource is defined within an 'inr#' you should specify 'inra'
  71.         'inra', 9002;                            // this ID is the same as the first field
  72.                                                 // for the desired item record in the 'inr#'
  73.         },
  74.     }
  75. };
  76.  
  77.  
  78. // • ResList atoms
  79.  
  80. // ResList atom for source >> SimpleText on root folder of tgt volume
  81.  
  82. resource 'inr#' (1000) {        // use any unique ID, 
  83.                                 // this ID will not be referenced
  84.     format0 {{
  85.  
  86.         // NOTE: The resource ID for the ResList resource  ( 'inr#' )
  87.         // is treated differently than all other installer resource types
  88.         // to be referenced from with a package resource ( 'inpk' ).
  89.         
  90.         // Normally ( as with Resource atoms [ 'inra' ] ), the resource
  91.         // type and the resource ID of the atom are specified within
  92.         // the package contents list. However, with ResList atoms ( 'inr#' )
  93.         // the ResList resource item is treated as a list of Resource
  94.         // atoms, rather than as a complete unit to be added to packages.
  95.         // When specifying the contents of an 'inr#' from within an 'inpk',
  96.         // specify the resource type 'inra' and the value specified in the
  97.         // first field of the set of fields that represent one resource item
  98.         // within the ResList atom ( 'inr#' ). The first two resource items
  99.         // in this ResList atom, for example, would be added to a package
  100.         // by specifying [ 'inra', 9000 ] and [ 'inra', 9001 ].
  101.  
  102.         // • first resource item in resource list for atom
  103.         
  104.         9000,                     // Resource ID listed in 'inpk'
  105.         
  106.         deleteWhenRemoving,
  107.         dontDeleteWhenInstalling,
  108.         copy,
  109.         leaveAloneIfNewer,        // 
  110.  
  111.         tgtRequired,
  112.         updateExisting,
  113.         copyIfNewOrUpdate,
  114.         dontIgnoreProtection,
  115.         srcNeedExist,
  116.         byID,
  117.         nameNeedNotMatch,
  118.         
  119.         0,                        // Size of Resource Item
  120.         10000,                    // TARGET - file spec ( 'intf' )
  121.         10000,                    // SOURCE - file spec ( 'infs' )
  122.         'vers',                    // Resource Item Type ( source and target )
  123.         3,                        // Resource Item ID ( source and target )
  124.         0,                        // Resource Item Attributes
  125.         
  126.         0x0,                    // Source Version Number - BCD format
  127.         0,                        // Version Compare Proc ID
  128.         0,                        // Atom Extender ID ( not currently supported )
  129.         0,                        // TARGET - size of resource
  130.  
  131.  
  132.         // • next resource item in resource list for atom
  133.         
  134.         9001,                     // Resource ID listed in 'inpk'
  135.         
  136.         deleteWhenRemoving,
  137.         dontDeleteWhenInstalling,
  138.         copy,
  139.         leaveAloneIfNewer,        // 
  140.  
  141.         noTgtRequired,
  142.         updateExisting,
  143.         copyIfNewOrUpdate,
  144.         dontIgnoreProtection,
  145.         srcNeedExist,
  146.         byID,
  147.         nameNeedNotMatch,
  148.         
  149.         0,                        // Size of Resource Item
  150.         10000,                    // TARGET - file spec ( 'intf' )
  151.         10000,                    // SOURCE - file spec ( 'infs' )
  152.         'vers',                    // Resource Item Type ( source and target )
  153.         4,                        // Resource Item ID ( source and target )
  154.         0,                        // Resource Item Attributes
  155.         
  156.         0x0,                    // Source Version Number - BCD format
  157.         0,                        // Version Compare Proc ID
  158.         0,                        // Atom Extender ID ( not currently supported )
  159.         0,                        // TARGET - size of resource
  160.  
  161.  
  162.         // • next resource item in resource list for atom
  163.         
  164.         9002,                     // Resource ID listed in 'inpk'
  165.         
  166.         deleteWhenRemoving,
  167.         dontDeleteWhenInstalling,
  168.         copy,
  169.         leaveAloneIfNewer,        // 
  170.  
  171.         noTgtRequired,
  172.         updateExisting,
  173.         copyIfNewOrUpdate,
  174.         dontIgnoreProtection,
  175.         srcNeedExist,
  176.         byID,
  177.         nameNeedNotMatch,
  178.         
  179.         0,                        // Size of Resource Item
  180.         10000,                    // TARGET - file spec ( 'intf' )
  181.         10000,                    // SOURCE - file spec ( 'infs' )
  182.         'vers',                    // Resource Item Type ( source and target )
  183.         5    ,                    // Resource Item ID ( source and target )
  184.         0,                        // Resource Item Attributes
  185.         
  186.         0x0,                    // Source Version Number - BCD format
  187.         0,                        // Version Compare Proc ID
  188.         0,                        // Atom Extender ID ( not currently supported )
  189.         0,                        // TARGET - size of resource
  190.     }}
  191. };
  192.  
  193. // NOTE - in this example resource list atom ( 'inr#' ), all resource 
  194. // items are contained in the same source file, and all resource items 
  195. // will be installed to the same target file.
  196.  
  197. // If you wish to store different resource items contained in the 
  198. // resource list atom in different source files, just declare the 
  199. // appropriate  'infs' spec for each source file and designate the 
  200. // different source files for each resource item in its section 
  201. // of the 'inr#'
  202.  
  203. // If you wish to install different resource items contained in the 
  204. // resource list atom to different target files, just declare the 
  205. // appropriate  'intf' spec for each target file and designate the 
  206. // different target files for each resource item in its section 
  207. // of the 'inr#'
  208.  
  209. // IMPORTANT SAFETY TIP :
  210. // The first resource item below specifies the flag 'tgtRequired' and
  211. // will generate an installation error if the target file "SimpleText"
  212. // does not already exist on the root folder of the tgt volume.
  213.  
  214. // The other resource items specify the flag 'noTgtRequired' and will
  215. // create a bogus copy of "SimpleText" on the root folder of the tgt 
  216. // volume that contains only the resource items just installed. It
  217. // will NOT generate an installation error. Scriptwriters should take
  218. // care when specifying 'noTgtRequired' during resource installation.
  219.  
  220.  
  221. // • file specs
  222. // target file spec for SimpleText application on root of target volume
  223. // NOTE: When a target spec is called from within a resource atom of
  224. // any kind ( 'inra', 'inrm', 'inr#' ), the type, creator, dates and
  225. // Finder attributes fields will only apply when creating a new file.
  226. resource 'intf' (10000) {
  227.     format1 {
  228.         noSearchForFile,                 // use default search path
  229.         
  230.         TypeCrMustMatch,                 // If this is set to TypeCrMustMatch
  231.                                         // then a file with a different type
  232.                                         // and creator than those specified
  233.                                         // below will not be updated.
  234.                                         // If this is set to TypeCrNeedNotMatch
  235.                                         // then type and creator of an existing
  236.                                         // target file are ignored.
  237.         
  238.         // The Type and Creator fields will be used to set the
  239.         // file's Type and Creator when a new file is created. 
  240.         'APPL',                         // TYPE for new file
  241.         'ttxt',                         // CREATOR for new file
  242.         
  243.         0,                                 // finder attribute flags
  244.                                         // filled by ScriptCheck is value is 0
  245.         
  246.         1,                                  // creation date for new file
  247.         1,                                  // modification date for new file
  248.                                         // NOTE: DATE values are filled
  249.                                         // by ScriptCheck if the value is 1
  250.                                             
  251.         0,                                 // search proc ID ( 'insp' ), none used
  252.         
  253.         ":SimpleText"            // path to target file
  254.         }
  255.     };
  256.  
  257. // shared source file spec for ResMerge source file
  258. resource 'infs' (10000) {
  259.     'rsrc',                        // TYPE for source file
  260.     'RSED',                        // CREATOR for source file
  261.     0x1,                        // creation DATE for source file
  262.     noSearchForFile,            // IGNORED in Installer 4.0.x
  263.     TypeCrMustMatch,            // TYPE, CREATOR must match file on install disk
  264.     "Disk 1:ResListSource.rsrc"    // PATH to source file        
  265. };
  266.  
  267.